]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Fill suggestion on button-press-event
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 22 Apr 2022 14:19:14 +0000 (16:19 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 10 Aug 2022 17:11:26 +0000 (17:11 +0000)
Like OSK key buttons, we must avoid the default grabbing behavior
of StButton here. Hook to button-press-event to commit the selected
words, so we get a chance to prevent focus changes on the current
key focus.

Likewise, connect to ::touch-event to handle touch input.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2278>

js/ui/keyboard.js

index 39066057ac7cd60b2df906bad99d36b117b7c5d6..e7b1eae4f6750b77689e7b0d8ee76a7f908edeaf 100644 (file)
@@ -175,7 +175,17 @@ class Suggestions extends St.BoxLayout {
 
     add(word, callback) {
         let button = new St.Button({ label: word });
-        button.connect('clicked', callback);
+        button.connect('button-press-event', () => {
+            callback();
+            return Clutter.EVENT_STOP;
+        });
+        button.connect('touch-event', (actor, event) => {
+            if (event.type() !== Clutter.EventType.TOUCH_BEGIN)
+                return Clutter.EVENT_PROPAGATE;
+
+            callback();
+            return Clutter.EVENT_STOP;
+        });
         this.add_child(button);
     }